package com.example.lenovo.demo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

public class FeedBackActivity extends AppCompatActivity {

    private Toolbar toolbar;
    private ImageView iv_feedback;
    private EditText et_feedback;
  //  String feed = et_feedback.getText().toString();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feed_back);

        et_feedback = (EditText) findViewById(R.id.et_feedback);

        iv_feedback = (ImageView) findViewById(R.id.iv_feedback);
        toolbar = (Toolbar) findViewById(R.id.feedback_toolbar);
        toolbar.setTitle("意见反馈");
        toolbar.setNavigationIcon(R.mipmap.register_left);
        // getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        iv_feedback.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               if (TextUtils.isEmpty(et_feedback.getText())){
                   Toast.makeText(FeedBackActivity.this, "内容不能为空", Toast.LENGTH_SHORT).show();
                   return;
               }else {
                   finish();
                   Toast.makeText(FeedBackActivity.this, "感谢您的反馈", Toast.LENGTH_SHORT).show();
               }
            }
        });

     }
}
